<div>
    <?php foreach ($chapters as $chapter): ?>
        <div><?php echo $chapter['name']; ?></div>
    <?php endforeach; ?>
    </div>

    <div>
    <?php foreach ($chapters as $chapter): ?>
            <div><?php echo $chapter['name']; ?></div>
    <?php endforeach; ?>
</div>